<?php
class Model_posting extends CI_Model{
    
    function insert_posting(){
        $data = array(
            'id_group' => $this->input->post('id_group'),
            'id_user' => $this->session->userdata('id_user'),
            'posting' => $this->input->post('posting')
        );
        return $this->db->insert('tb_posting',$data);
    }
    
    function show_posting($id){
        $query = $this->db->query("SELECT p.id_posting, p.id_group, p.id_user, u.profpic, u.nama, p.posting FROM 
tb_posting p,
tb_user u
WHERE p.id_group = $id AND u.id_user = p.id_user ORDER BY p.id_posting DESC");
        return $query->result();
    }
}
?>
